package com.hyh.user.controller;


import com.hyh.user.domain.Address;
import com.hyh.user.result.PageResult;
import com.hyh.user.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/address")
public class AddressController {
    @Autowired
    private AddressService addressService;


    /*
     * @description: 添加地址信息
     * @param:
     * @return:
     * @author
     * @date: 2024/3/20 15:32
     */
    @PostMapping("/add")
    public PageResult addAddress(@RequestBody Address address) {
        return addressService.addAddress(address);
    }


    /*
     * @description: 查询个人的地址信息
     * @param:
     * @return:
     * @author
     * @date: 2024/3/20 15:33
     */
    @GetMapping("/list/{userId}")
    public PageResult listAddress(@PathVariable("userId") Long userId) {
        return addressService.selectListAddress(userId);
    }
}
